import sys

#####
# 功能: 根据金属层类型和宽度，密度，计算金属层间距
#####

metal_layer = str(sys.argv[1])
metal_width = round(float(sys.argv[2]), 3)

if len(sys.argv) > 3:
    metal_density = round(float(sys.argv[3]), 3)
else:
    metal_density = 0

## DRC规则：Mxx.DN.2.1
density_dict = {"Mz": 0.85, "Mr": 0.85, "Myy":0.85, "My":0.75}
metal_dict = {"M13":"Mr", "M12":"Mr", "M11":"Myy", "M10":"Myy", "M9":"My"}

def get_space(layer, width, density=0):
    if density==0:
        d = density_dict[metal_dict[layer]]
        print(round(width/d-width, 3))
    else:
        d = density
        print(round(width/d-width, 3))

get_space(metal_layer, metal_width, metal_density)